<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // ES6中引入扩展操作符(展开语法)，可以方便传入多个参数
        //     扩展操作符，是可以展开数组和对象的
        //     扩展操作符和剩余参数拥有相似的语法
                // 不同：
                //     剩余参数是把所有多余的参数进行收集起来转换成数组
                //     而扩展操作符把数组扩展成单个参数


        let nums=[100,200,300,89,7600];
        console.log(Math.max(23,45,90,7,890,5678,5432,1));
        // console.log(Math.max(nums));//不支持数组作为参数的
        console.log(Math.max.apply(nums,nums));//将第二个参数进行自行的循环展开，将数组的元素对应的赋值给函数的形参
        console.log(Math.max(...nums));//将数组扩展成单个参数
        console.log(Math.min(...nums));

        //数组展开
        let arr1=["a","b"];
        let arr2=["c","d"];
        let arr3=[100,...arr1,...arr2];
        console.log(arr3);

        //对象展开
        let obj1={id:1,name:"tom"};
        let obj2={name:"coco",course:"Web"};
        let obj3={gender:"female",...obj1,...obj2};
        console.log(obj3);

        let objs={name:"lili",hobby:"打球",gender:"女",java:98,html:99};
        let {name,gender,...attrs}=objs;
        console.log(name,gender,attrs);
    </script>

</head>
<body>
    
</body>
</html>